#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const ll mod = 1000000007;
using namespace std;

int H,W;
char G[1010][1010];
ll f[1010][1010];
ll sovle(){
    f[1][1] = 1;
    for(int i = 1;i<=H;i++){
        for(int j = 1;j<=W;j++){
            if(i == 1 && j == 1) continue;
            if(G[i][j] == '#') continue;
            f[i][j] = (f[i-1][j] + f[i][j-1]) %mod;
        }
    }
    return f[H][W];
}

int main(){
    // debug;
    ios;
    cin>>H>>W;
    for(int i = 1;i<=H;i++){
        for(int j = 1;j<=W;j++){
            cin>>G[i][j];
        }
    }
    cout<<sovle()<<'\n';



    
    return 0;
}
